package factory.simplefactory.order;

import factory.simplefactory.pizzasrore.ChesssePizza;
import factory.simplefactory.pizzasrore.GreekPizza;
import factory.simplefactory.pizzasrore.Peper;
import factory.simplefactory.pizzasrore.Pizz;

/**
 * @Author liangliangzhao
 * @data 2023/2/14 11:02
 */

public class SimpleFactory {
    public Pizz createPizza(String orderType){

        Pizz pizz = null;
        System.out.println("使用简单工厂模式");
        if(orderType.equals("greek")){
            pizz = new GreekPizza();
            pizz.setName("希腊披萨");
        }else if(orderType.equals("cheese")){
            pizz = new ChesssePizza();
            pizz.setName("奶酪披萨");
        }else if(orderType.equals("peper")){
            pizz = new Peper();
            pizz.setName("胡椒披萨");
        }

        return pizz;
    }
}
